import { _decorator, Component, Node, Sprite, SpriteFrame } from 'cc';
import { KugoPiecesType } from '../../KugoConst';
import { ChessPoint } from '../../proto/proto';
const { ccclass, property } = _decorator;

/**棋子管理 */
@ccclass('ChessPieces')
export class ChessPieces extends Component {
    
    /** 棋子操作标记 */
    @property(Sprite)
    spr:Sprite = null

    /** 可以吃棋子标记 */
    @property(Node)
    killFlag:Node = null

    private _type:KugoPiecesType = KugoPiecesType.NONE
    private _point:ChessPoint = null
    start() {

    }

    setType(piecesType: KugoPiecesType, spr:SpriteFrame){
        this._type = piecesType
        this.spr.spriteFrame = spr
        this.killFlag.active = false
    }

    getType(){
        return this._type
    }

    setPoint(point: ChessPoint){
        this._point = point
    }

    getPoint(){
        return this._point
    }

    showKillFlag(){
        this.killFlag.active = true
    }
}


